package com.example.pojo.pojoenum;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

@AllArgsConstructor
@Getter
@Slf4j
public enum Grade {
    BIG_CLASS(1,"小班"),
    MEDIUM_CLASS(2,"中班"),
    SMALL_CLASS(3,"大班"),
    OBFUSCATE(4,"没用");

    public static Grade getEnum(String name) {
        for (Grade item : values()) {
            if (item.getValue().equals(name)) {
                return item;
            }
        }
        return null;
    }

    @EnumValue
    private final int code;
    @JsonValue
    private final String value;
}

